<?php

namespace App\Console\Commands;

use App\Library\Logic\ShopUserLogic;
use Illuminate\Console\Command;

class ShopUserDeleteCommand extends Command
{
    /**
     * 删除已删除的用户账号
     *
     * @var string
     */
    protected $signature = 'command:userDelete';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Execute the console command.
     */
    public function handle(): void
    {
        $model = ShopUserLogic::query()->where('user_delete_flag', 1)->pluck('user_id')->toArray();

        if (!is_null($model)) {
            ShopUserLogic::query()->whereIn('user_id', $model)->delete();
        }
    }
}
